using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace BookingDB.Models.Mapping
{
    public class SeatMap : EntityTypeConfiguration<EntitySeat>
    {
        public SeatMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.status)
                .HasMaxLength(1);

            // Table & Column Mappings
            this.ToTable("Seat");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.status).HasColumnName("status");
            this.Property(t => t.show_id).HasColumnName("show_id");

            // Relationships
            this.HasOptional(t => t.Show)
                .WithMany(t => t.Seats)
                .HasForeignKey(d => d.show_id);

        }
    }
}
